package com.itheima.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflactDemo3 {
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class c = Student.class;
        Constructor c1 = c.getConstructor();
        Object obj1 = c1.newInstance();
        System.out.println(obj1);

        Constructor c2 = c.getConstructor(String.class, int.class);
        Object obj2 = c2.newInstance("zhangsan", 23);
        System.out.println("obj2 = " + obj2);
    }
}
